<#compress>
    <#assign actionname>${(action=='create')?string('新建','编辑')}</#assign>
    <@override name="title">影片信息</@override>
    <@override name="viewbody">
    <div class="row">
        <div class="col-md-12">
            <h3 class="page-title">
            影迷天下
                <small>影片信息.</small>
            </h3>
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="${ctx}/admin/home">
                        首页
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="${ctx}/admin/movie/info">
                        影迷天下
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">
                    影片信息
                    </a>
                </li>
            </ul>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading"><h6 class="panel-title">影片信息</h6></div>
        <div class="panel-body">
            <form class="form-horizontal" action="${ctx}/admin/movie/info/save" role="form" id="movieInfo" method="post">
                <input name="movie.id" type="hidden" value="${(movie.id)!}"/>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movie.name">名称: <span class="required">*</span></label>
                    <div class="col-sm-10">
                        <input type="text" class="required form-control input-xlarge" placeholder="名称"
                               name="movie.name" id="movie.name" value="${(movie.name)!}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">封面：</label>
                    <div class="col-md-10 single_pic">
                        <input type="hidden" id="picture" name="movie.cover" value="${movie.cover!}">
                        <input id="logoAttachmentUpload" type="file" class="btn">

                        <div class="picture col-md-8" id="show_picture" style="display: ${(movie.cover??)?string('display','none')};">
                            <a href="<#if movie.cover??>${ctx}/${movie.cover}</#if>"
                               class="thumbnail fancybox-button" id="box_picture" data-rel="logo">
                                <img src="<#if movie.cover??>${ctx}/${movie.cover?replace('.','.thumbnail.')}</#if>"
                                     alt=""/>
                            </a>
                            <a href="#" class="action" data-hook="remove_picture" data-target="#picture"
                               data-data="${movie.cover!}"><i class="fa fa-times"></i> </a>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movieShowtimes">上映时间: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <div class="input-group input-medium input-xlarge date form_datetime" data-link-field="movie.showtimes">
                            <input class="required form-control" size="16" readonly type="text" value="${(movie.showtimes)!}" name="showtimes" id="movieShowtimes">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                        </div>
                        <input type="hidden" id="movie.showtimes" name="showtimes" value="">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movie.states">状态: <span class="required">*</span></label>
                    <div class="col-sm-10">
                        <select class="form-control input-xlarge select2me" id="movie.states" name="movie.states">
                            <#list movieStatus.keySet() as key>
                            <option value="${key}" <#if movie.states??> <#if movie.states == key> selected </#if></#if>>${movieStatus.get(key)!}</option>
                            </#list>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="play_time">播放场次: <span class="required">*</span></label>
                    <div class="col-sm-10" id="play_time_el">

                        <#if playTimeList??>
                            <#list playTimeList as t>
                                <#if t_index != 0>
                                    <br/>
                                </#if>
                                <div class="input-group input-xlarge">
                                    <span class="input-group-btn">
                                        <input type="text" class="form-control required timepicker timepicker-24" placeholder="时间" name="play_time_time_${t_index}" value="${t.time!}">
                                    </span>
                                    <span class="input-group-btn">
                                        <input type="text" class="form-control required" placeholder="影厅" name="play_time_place_${t_index}" value="${t.place!}">
                                    </span>
                                    <span class="input-group-btn">
                                        <input type="text" class="form-control required" placeholder="价格" name="play_time_price_${t_index}" value="${t.price!}">
                                    </span>
                                    <span class="input-group-btn">
                                        <#if t_index == 0>
                                            <button class="btn blue" type="button" name="oper_play_time" oper="add"> + </button>
                                        <#else>
                                            <button class="btn red" type="button" name="oper_play_time" oper="cut"> - </button>
                                        </#if>
                                    </span>
                                </div>
                            </#list>
                        <#else>
                            <div class="input-group input-xlarge">
                                <span class="input-group-btn">
                                    <input type="text" class="form-control required timepicker timepicker-24" placeholder="时间" name="play_time_time_0">
                                </span>
                                <span class="input-group-btn">
                                    <input type="text" class="form-control required" placeholder="影厅" name="play_time_place_0">
                                </span>
                                <span class="input-group-btn">
                                    <input type="text" class="form-control required" placeholder="价格" name="play_time_price_0">
                                </span>
                                <span class="input-group-btn">
                                    <button class="btn blue" type="button" name="oper_play_time" oper="add"> + </button>
                                </span>
                            </div>
                        </#if>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movie.book_url">预定地址: <span class="required">*</span></label>
                    <div class="col-sm-10">
                        <input type="text" class="required form-control input-xlarge" placeholder="预定地址"
                               name="movie.book_url" id="movie.book_url" value="${(movie.book_url)!}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movie.description">影片概述: </label>
                    <div class="col-sm-10">
                        <textarea rows="5" cols="5" id="movie.description" class="limited form-control input-xlarge"
                                  name="movie.description"
                                  placeholder="请输入描述">${(movie.description)!}</textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="movie.plot">电影剧情: </label>

                    <div class="col-sm-10">
                        <textarea rows="20" cols="10" id="plot" class="limited required form-control input-xlarge"
                                  name="movie.plot"
                                  placeholder="请输入剧情">${movie.plot!}</textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label" for="mo_prictures">&nbsp; </label>

                    <div class="col-md-9">
                        <p class="form-control-static">
                            <input id="prictureAttachmentUpload" type="file" class="btn">
                        </p>
                        <input type="hidden" id="mo_prictures" name="movie.poster" value="${movie.poster!}">
                    </div>
                </div>


                <div class="row">
                    <div class="col-md-12 picture_grid" id="pricture-grid">
                        <#if pics??>
                            <#list pics as pic>
                                <#assign new_line = ((pic_index+1) % 4 == 0)/>
                                <#if new_line>
                                <div class="row margin-top-10">
                                </#if>
                                <div class="col-sm-6 col-md-3 picture">
                                    <a href="${ctx}${pic!}" class="thumbnail fancybox-button" data-rel="fancybox-button">
                                        <img class="" src="${ctx}${pic?replace('.','.thumbnail.')}" alt="">
                                    </a>
                                    <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
                                       data-data="${pic!}"><i class="fa fa-times"></i> </a>
                                </div>
                                <#if new_line>
                                </div>
                                </#if>
                            </#list>
                        </#if>
                    </div>
                </div>


                <div class="form-actions text-right">
                    <a class="btn default yellow-stripe" href="${ctx}/admin/movie/info"><i
                            class="fa fa-arrow-circle-o-left"></i> 返回</a>
                    <input type="submit" value="保存" class="btn btn-primary">
                </div>
            </form>
        </div>
    </div>


    <script id="showpics-template" type="text/x-handlebars-template">
        <div class="col-sm-6 col-md-3 picture">
            <a href="{{ctx}}{{preview}}" class="thumbnail fancybox-button" data-rel="fancybox-button">
                <img class="" src="{{ctx}}{{data}}" alt="">
            </a>

            <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
               data-data="{{preview}}"><i class="fa fa-times"></i> </a>
        </div>
    </script>

    <script id="playtime-template" type="text/x-handlebars-template">
        <br/>
        <div class="input-group input-xlarge">
            <span class="input-group-btn">
                <input type="text" class="form-control required timepicker timepicker-24" placeholder="时间" name="play_time_time_{{id}}">
            </span>
            <span class="input-group-btn">
                <input type="text" class="form-control required" placeholder="影厅" name="play_time_place_{{id}}">
            </span>
            <span class="input-group-btn">
                <input type="text" class="form-control required" placeholder="价格" name="play_time_price_{{id}}">
            </span>
            <span class="input-group-btn">
                <button class="btn red" type="button" name="oper_play_time" oper="cut"> - </button>
            </span>
        </div>
    </script>
    </@override>

    <@override name="viewparams">
    g.preview_template = '#showpics-template';
    g.playtime_template = '#playtime-template';
    </@override>


    <@override name="viewstyles">
    <link href="${ctx}/static/scripts/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"/>
    </@override>
    <@override name="viewmodule">movie_item</@override>
    <@extends name="../../_basic/main.ftl"></@extends>
</#compress>